﻿using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TfsGetBuildDrop.Core
{
    public class CompressionUtlity
    {

        private static string CreateTempZipFileFromStream(MemoryStream stream)
        {
            var fileName  = System.IO.Path.GetTempFileName();
            FileStream file = new FileStream(fileName, FileMode.Create);

            stream.WriteTo(file);

            file.Close();

            return fileName;

      
        }
        public static void UnZipStream(MemoryStream stream, string outputDir)
        {

            var filename = CreateTempZipFileFromStream(stream);

            ZipFile.ExtractToDirectory(filename, outputDir);
            
        }

    }
}
